<html>
<head>
<script type="text/javascript">
// Pour configurer le timer il suffit de changer 
//les 4 variables de dessous
var sec=60, cteSec=60;
var min=2, cteMin=2;
var t;
vartimer_is_on=0;

function timedCountMoins()
{
if(sec>0){
sec=sec-1;
}else{
sec=cteSec-1;
min=min-1;
}

if(min == 0 && sec==0){
 t=setTimeout("timedCountPlus()",1000);
}else{
 t=setTimeout("timedCountMoins()",1000);
}
document.getElementById('txt').value=min +" : "+sec;

}

function timedCountPlus()
{
document.getElementById('txt').style.backgroundColor="#FF4500";
if(sec<cteSec-1){
sec=sec+1;
}else{
sec=0;
min=min+1;
}
t=setTimeout("timedCountPlus()",1000);
document.getElementById('txt').value=min +" : "+sec;
}

function doTimer()
{
document.getElementById('txt').style.backgroundColor="#FFFFFF";

//if (!timer_is_on)
 // {
timer_is_on=1;
timedCountMoins();
document.getElementById('btnStart').disabled = true;
document.getElementById('btnStop').disabled = false;
 // }
}

 function stopCount()
{
clearTimeout(t);
timer_is_on=0;
sec=cteSec;
min=cteMin;
document.getElementById('btnStop').disabled = true;
document.getElementById('btnStart').disabled = false;
}
</script>
</head>
<body>
<form>
<input type="button" id="btnStart" value="Start count!" onClick="doTimer()" />
<input type="text" id="txt" />
<input type="button" id="btnStop" value="Stop count!" onClick="stopCount()" />
</form>
<p>
Click on the "Start count!" button to start the timer again. <br>
Click on the "Stop count!" button to stop the counting. 
</p>
</body>
</html>
